package com.sh.data.engine.domain.normalization.standard.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sh.data.engine.domain.base.model.PageResult;
import com.sh.data.engine.domain.normalization.research.themedesign.model.domain.ThemeDomain;
import com.sh.data.engine.domain.normalization.standard.model.domain.DictionaryByArgDomian;
import com.sh.data.engine.domain.normalization.standard.model.domain.DictionaryDetailDomain;
import com.sh.data.engine.domain.normalization.standard.model.domain.DictionaryDomain;
import com.sh.data.engine.domain.normalization.standard.model.domain.DictionaryItemDomain;
import com.sh.data.engine.domain.normalization.standard.model.param.DictionaryOptParam;
import com.sh.data.engine.domain.normalization.standard.model.param.DictionaryParam;
import com.sh.data.engine.domain.normalization.standard.model.param.DictionaryQueryParam;
import com.sh.data.engine.repository.dao.normalization.standard.arg.DictionaryQueryArg;
import com.sh.data.engine.repository.dao.normalization.standard.entity.DictionaryEntity;
import jakarta.servlet.http.HttpServletResponse;

import java.util.List;
import java.util.Map;

/**
 * @author jingchen.hr
 */
public interface IDictionaryService extends IService<DictionaryEntity> {

    /**
     * 添加字典
     *
     * @param param
     * @return
     */
    Boolean addDictionary(DictionaryParam param);

    /**
     * 字典管理列表查询
     *
     * @param request
     * @return
     */
    PageResult<DictionaryItemDomain> listDictionary(DictionaryQueryParam request);

    /**
     * 编辑字典
     *
     * @param param
     * @return
     */
    Boolean editDictionary(DictionaryParam param);

    /**
     * 删除字典
     *
     * @param userId
     * @param param
     */
    void deleteDictionary(String userId, DictionaryOptParam param);

    /**
     * 发布或下架字典
     *
     * @param userId
     * @param param
     */
    void releaseDictionary(String userId, DictionaryOptParam param);

    /**
     * 字典详情查询
     *
     * @param id
     * @return
     */
    DictionaryDetailDomain detailDictionary(Long id);

    /**
     * 字典列表查询
     *
     * @param param
     * @return
     */
    PageResult<DictionaryEntity> queryDictionaryEntityPage(DictionaryQueryParam param);

    /**
     * 根据目录id查字典
     *
     * @param dictDirIds
     * @return
     */
    List<DictionaryEntity> getListByDictDirIds(List<Long> dictDirIds);

    /**
     * 根据ids查字典map
     *
     * @param ids
     * @return
     */
    Map<Long, DictionaryEntity> getMapByIds(List<Long> ids);

    /**
     * 字典映射列表
     *
     * @param dictionaryQueryArg
     * @return
     */
    List<DictionaryByArgDomian> queryListByArg(DictionaryQueryArg dictionaryQueryArg);

    /**
     * 导入字典
     *
     * @param dataList
     * @param headRowNumber
     */
    void importDictionary(List<List<String>> dataList, int headRowNumber);

    /**
     * 根据ids查字典
     *
     * @param ids
     * @return
     */
    List<DictionaryItemDomain> getListByIds(List<Long> ids);

    /**
     * 批量操作接口
     *
     * @param userId
     * @param ids
     * @param optType 0批量发布 1批量删除 2批量下线
     */
    void batchOpt(String userId, List<Long> ids, Integer optType);

    /**
     * 导出
     *
     * @param ids
     * @param response
     */
    void exportList(List<Long> ids, HttpServletResponse response);

    /**
     * description 获取所有未删除的字典
     *
     * @author : mingxi.xpb
     * @date : 2022/1/21 11:31
     */
    List<DictionaryDomain> getAllDictionary(Long projectId);

    /**
     * 获取已发布的字典列表
     */
    List<DictionaryDomain> getPublishedDictionaries(Long projectId);

    /**
     * 获取数据标准主题目录
     *
     * @param projectId
     * @return
     */
    List<ThemeDomain> getThemesForStand(Long projectId);

    List<DictionaryDomain> getRealeseDic(Long projectId);

    List<DictionaryDomain> getRealeseDicDetail(String dictNameEn, String dictNameCn);

    /**
     * @description : 根据主题id查询
     * @author : tinglan.ys
     * @date : 2022/4/28
     */
    List<DictionaryEntity> getDictionaryByThemeId(Long themeId);

    /**
     * 根据字段名匹配标准规则
     *
     * @param filedNames
     * @param projectId
     * @return
     */
    List<DictionaryDomain> getDictionaryByFiledName(List<String> filedNames, Long projectId);

    List<DictionaryDomain> getListByPage(Long projectId, Integer pageSize, Integer pageNum);

    List<DictionaryEntity> getListDicAll(Long projectId);
}
